package com.demo.service.impl;

import com.demo.entity.Student;
import com.demo.entity.Teacher;
import com.demo.entity.TeacherExample;
import com.demo.repository.StudentRepository;
import com.demo.repository.TeacherRepository;
import com.demo.service.AdminServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class adminServiceImpl implements AdminServer {

    @Autowired
    StudentRepository studentRepository;
    @Autowired
    TeacherRepository teacherRepository;

    @Override
    public List<Student> selectStudent(Integer classid, String stuName) {
        List<Student> students = studentRepository.selectStudent(classid, stuName);
        return students;
    }

    @Override
    public Student insertStudent(Student student) {
        studentRepository.insertSelective(student);
        return student;
    }

    @Override
    public List<Teacher> selectTeacher(String subjectName) {
        return teacherRepository.selectTeacher(subjectName);
    }

    @Override
    public Teacher insertTeacher(Teacher teacher) {
        teacherRepository.insertSelective(teacher);
        return teacher;
    }
}
